﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Evolution.Structure;
using Evolution.Structure.Globe;

namespace EvolutionLogic.Handler
{
    /// <summary>
    /// Contains all the Logic necessary during a change from one turn to a new one
    /// </summary>
    class TurnHandle
    {
        public Player PlayerData {get; private set;}
        public int TurnId {get; private set;}


        public TurnHandle(Player playerData)
        {
            this.PlayerData = playerData;
        }

        /// <summary>
        /// Calculate all the harvested Resources
        /// </summary>
        /// <returns></returns>
        private Resources CaclulateWorkerResources()
        {
            throw new NotImplementedException();
            /* Look into penalty list
             * 
             * for each town => 
             *  look into building list and sum up all benefits
             *   for each worker => sum up harvested resources
             */
        }

        /// <summary>
        /// calculate the Resources gathered by Researchers and Philosophers
        /// </summary>
        /// <returns></returns>
        private Resources CalculateMentalResources()
        {
            throw new NotImplementedException();
            /*
             * Run through all cities and count cultural and researchpoints 
             */
        }

        /// <summary>
        /// Calculate MaintenanceCosts
        /// </summary>
        /// <returns></returns>
        private double CalculateMaintenanceCosts()
        {
            double costs = 0;
            foreach (var units in PlayerData.Units)
            {
                costs += units.MaintenanceCosts;
            }
            return costs;
        }

        /// <summary>
        /// Switch to new Turn
        /// </summary>
        /// <returns></returns>
        public int NextTurn()
        {
            /* Set new Resources (plus the gathered; minus the maintenance)
             * Set Technology Progress
             * Run through Cities and set Building Progress
             * 
             */
            return TurnId++;
        }

    }
}
